package com.example.login.securitylogin.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by luoyiliang on 2017/7/12.
 */

@Controller
public class HelloController
{

	@RequestMapping(value = {"/", "/index**"}, method = RequestMethod.GET)
	public String welcomePage()
		{
			return "index";
		}

	@RequestMapping(value = "/admin**", method = RequestMethod.GET)
	public ModelAndView adminPage()
		{
			ModelAndView model = new ModelAndView();
			model.addObject("title", "Spring Security Hello World");
			model.addObject("message", "This is protected page!");
			model.setViewName("admin");
			return model;
		}

	@RequestMapping(value = "/login**", method = RequestMethod.GET)
	public String login()
		{
			return "login";
		}

}